window.workspace = function(){
	var response  = <?#$respons?>;
	var store, grid, sm;
	var sid = {'userid':Ext.id(), 'sdate':Ext.id(), 'edate':Ext.id(), 'status':Ext.id()};
	sm    = new Ext.grid.CheckboxSelectionModel();
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url			: '/admin/live/finance/payment/dolist.html',
	    remoteSort	: true,
	    sortInfo	: {
            field		: 'stime',
            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
	    fields			: ['userid', 'nickname', 'first_name', 'last_name', 'birthday', 'country',
	       'currency', 'bank_account', 'transit_number', 'instititional_number', 'photo_id', 'documentid', 
	       'stripeid', 'status', 'failure', 'firstname', 'lastname', 'paypal', 'stime']
	});
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
	    columns		: [
	        sm,
			{header: 'Userid', width:40, sortable:true, dataIndex:'userid'},
			{header: 'Anchor', width:80, dataIndex:'nickname'},
			{header: 'FirstName', width:40, dataIndex:'first_name'},
			{header: 'LastName', width:40, dataIndex:'last_name'},
			{header: 'Birthday', width:40, dataIndex:'birthday', renderer:function(v,meta,obj){
				if(obj.get('bank_account') == '') {
					return '';
				}
				return v;
			}},
			{header: 'Country', width:40, dataIndex:'country'},
			{header: 'Currency', width:40, dataIndex:'currency'},
			{header: 'BankAccountNumber', width:120, dataIndex:'bank_account'},
			{header: 'TransitNumber', width:60, dataIndex:'transit_number'},
			{header: 'InstititionalNumber', width:80, dataIndex:'instititional_number'},
			{header: 'PhotoId', width:40, dataIndex:'photo_id', renderer:function(v,meta,obj){
				if(obj.get('bank_account') == '') {
					return '';
				}
				return '<img src="'+v+'" width="20" height="20" />';
			}},
			{header: 'Documentid', width:60, dataIndex:'documentid'},
			{header: 'Stripeid', width:40, dataIndex:'stripeid'},
			{header: 'AccountStatus', width:60, sortable:true, dataIndex:'status', renderer:function(v,meta,obj) {
				if(obj.get('bank_account') == '') {
					return '';
				}
				return response.status[v];
			}},
			{header: 'Failure', width:60, dataIndex:'failure'},
			{header: 'Paypal', width:80, dataIndex:'paypal'},
			{header: 'PaypalFirstName', width:50, dataIndex:'firstname'},
			{header: 'PaypalLastName', width:50, dataIndex:'lastname'},
			{header: 'LastTime',width:110, sortable:true,dataIndex:'stime'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
		listeners	: {
			'render':function(obj){
				main.gridRender(obj, ['photo_id']);
	    	}
		},	
	    sm			: sm,
	    stripeRows	: true,
	    tbar		: [{
			text	: 'Reload',
			iconCls	: 'icon-refresh',
			handler : function(){
				store.reload(); 
			}
	    },'-','<b>Search For：</b>','AnchorNick:',{
			xtype		: 'combo',
			store		: new Ext.data.JsonStore({
				url		: '/admin/live/share/douser.html',
				autoDestroy: true,
				fields: ['id', 'name'],
				root: 'dataset'
			}),
			id			: sid.userid,
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'selected...',
			minChars		: 1,
			 pageSize		: 10,
            listWidth		: 258,
            width			: 120,
			typeAhead		: true,
			typeAheadDelay  : 0,
			triggerAction	: 'all',
			enableKeyEvents : true,
			mode			: 'remote'
		},'-','Status:',{
			xtype		: 'combo',
			store		: new Ext.data.ArrayStore({
		        fields: ['id','name'],
		        data: main.cv2Array(response.status)
		    }),
			displayField	: 'name',
			valueField		: 'id',
			mode			: 'local',
			triggerAction	: 'all',
			emptyText		: 'selected...',
			width			: 80,
			id  			: sid.status
		},'-','LastTime:',{
			xtype       : 'datefield',
			id  		: sid.sdate,
			width	    : 100
		},'<->',{
			xtype       : 'datefield',
			id  		: sid.edate,
			width	    : 100
		},'-',{
			text			: 'Do Search',
			iconCls			: 'icon-search',
			handler: function() {
				store.baseParams.userid= Ext.getCmp(sid.userid).getValue();
				store.baseParams.status= Ext.getCmp(sid.status).getValue();
				store.baseParams.sdate = Ext.getCmp(sid.sdate).getValue();
				store.baseParams.edate = Ext.getCmp(sid.edate).getValue();
				store.reload(); 
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();